//引入路由相关
import { createRouter, createWebHistory } from "vue-router";

const routes = [
    {
        path: "/",
        redirect: '/login',//重定向到登录页面
    }, {
        path: "/login",
        name: 'login',
        props: true,
        component: () => import("../page/user/login.vue"),
    }, {
        path: "/enroll",
        name: 'enroll',
        props: true,
        component: () => import("../page/user/enroll.vue"),
    }, {
        path: "/change",
        name: 'change',
        props: true,
        component: () => import("../page/user/change.vue"),
    }, {
        path: "/index",
        name: 'index',
        props: true,
        component: () => import("../page/index.vue"),
        redirect: '/index/musicList',//访问index重定向到推荐音乐里面
        children: [
            {
                path: 'musicList',
                name: "musicList",
                props: true,
                component: () => import("../page/indexMain/MusicList.vue")
            }, {
                path: 'videoList',
                name: "videoList",
                props: true,
                component: () => import("../page/indexMain/videoList.vue")
            }, {
                path: 'myFavorite',
                name: "myFavorite",
                props: true,
                component: () => import("../page/indexMain/MyFavorite.vue")
            }, {
                path: 'download',
                name: "download",
                props: true,
                component: () => import("../page/indexMain/download.vue")
            },
        ]
    }, {
        path: '/user',
        name: "user",
        props: true,
        component: () => import("../page/user/userIndex.vue")
    }
]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router